﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Text;
namespace MYNAMESPACE
{
    
    
    
  

    class Bank_person
    {
         protected string name=" ", address, mail, gender;
        protected int national_id, age;
        protected long phone;
    }

    
    public class connect_db
    {

        private SqlConnection con;
        public SqlCommand cmd;
        private SqlDataAdapter ad;
        private DataTable dt;
       
        //consractor 
        public connect_db()
        {
            con = new SqlConnection(@"Data Source =AMR-TOSH; Initial Catalog =Bank_System ;Integrated Security= True;");
            con.Open();

        }
        public void sqlquery(string query)
        {

            cmd = new SqlCommand(query, con);
        }
        public DataTable QueryEx()
        {
            ad = new SqlDataAdapter(cmd);
            dt = new DataTable();
            ad.Fill(dt);
            return dt;

        }

        public void sqlnonex()
        {

            cmd.ExecuteNonQuery();
        }



    }
   
    class user :Bank_person
    {
        double balance=0;
        string password=" ";
        double value;

        string co_id;

        public void setco_id(string x)
        {

            co_id = x;
        }
        public string getco_id()
        {
            return co_id;
        }

        //public bool check(double x)
        //{
            
        //    if (x=)
        //    {
        //        return false;
        //    }

        //    else
        //    {
                
        //        return true;


        //    }


        //}


        public void setvalue(double x)
        {

            value = x;
        }
        public double getvalue()
        {
            return value;
        }
        /// <summary>
        /// //
        /// </summary>
        /// <param name="x"></param>
 
        public bool setage(int x)
        {
            if (x >= 21)
            {
                age = x;
                return true;
            }
            else { return false; }
            
        }
        public int getage()
        {
            return age;
        }
        //-----------------------------age
        public void setbalance(double x)
        {
            if (x > 1000)
            {
                balance += x;//bool
            }
            else
            {
               // System.Windows.Forms.MessageBox.Show("YOUER ACCOUNT MUST START WITH 1000 L.E OR MORE", "ERROR");
            }
        }
        public double getbalance()
        {
            return balance;
        }
        //-----------------------------balance
        public void setnational_id(int x)
        {

            national_id = x;
        }
        public int getnational_id()
        {
           
            
            
              return national_id;
        
        }
        
        //-------------------------------id
        public void setname(string n)
        {
            name = n;
        }
        public string getname()
        {
            return name;
        }
        //------------------------------name
        public void setpassword(string n)
        {
            password = n;
        }
        public string getpassword()
        {
            return password;
        }
        //----------------------------password
        public void setaddress(string n)
        {
            address = n;
        }
        public string getaddress()
        {
            return address;
        }
        //----------------------------address
        public void setemail(string n)
        {
            mail = n;
        }
        public string getmail()
        {
            return mail;
        }
        //----------------------------mail
        public void setgender(string n)
        {
            gender = n;
        }
        public string getgender()
        {
            return gender;
        }
        //----------------------------gender
        public void setphone(long n)
        {
            phone = n;
        }
        public long getphone()
        {
            return phone;
        }
        //----------------------------phone

        //
        //ACCOUNT OPERATIONS
        //
        public bool deposite(double x)
        {
           // System.Windows.Forms.MessageBox.Show(x.ToString());
            if (x < 100)
            {
                return false;               
            }

            else
            {
                balance += x;
                return true;
                

            }


        }

        public void BAY_deposite(double x) 
        {
            // System.Windows.Forms.MessageBox.Show(x.ToString());
           
                balance += x;


        }

        //----------------------------deposite


        public bool withdrwal(double x)
        {
            if (balance >= value)
            {
                balance -= x;
                return true;
            }
            else { return false; }
            
            
        }


        public bool ATM_withdrwal(double x)
        {
            if (balance >= value && value <= balance * 0.25)
            {
                balance -= x;
                return true;
            }
            else { return false; }
        }

            public bool Recharge_withdrwal(double x)
        {
            if (balance >= value && value<501)
            {
                balance -= x;
                return true;
            }
            else { return false; }

        }
        
        //---------------------------withdrwal
        // shodata >> database
    }//end class user 

    class employee :Bank_person
    {

        string password = " ";
        double Salary;

        string kindofjob;
        public void setkindofjob(string n)
        {
            kindofjob = n;
        }
        public string getkindofjob()
        {
            return kindofjob;
        }
        //---------------------------kindofjob


        public void setnational_id(int x)
        {
            national_id = x;
        }
        public int getnational_id()
        {
            return national_id;
        }
        //-------------------------------id
        public void setname(string n)
        {
            name = n;
        }
        public string getname()
        {
            return name;
        }
        //------------------------------name
        //
        public void setaddress(string n)
        {
            address = n;
        }
        public string getaddress()
        {
            return address;
        }
        public void setpassword(string n)
        {
            password = n;
        }
        public string getpassword()
        {
            return password;
        }
        //----------------------------address
        public void setemail(string n)
        {
            mail = n;
        }
        public string getmail()
        {
            return mail;
        }
        //----------------------------mail
        public void setgender(string n)
        {
            gender = n;
        }
        public string getgender()
        {
            return gender;
        }
        //----------------------------gender
        public void setphone(long n)
        {
            phone = n;
        }
        public long getphone()
        {
            return phone;
        }
        //----------------------------phone
        public void setage(int x)
        {

            age = x;
        }
        public int getage()
        {
            return age;
        }
        public void setSalary(double x)
        {

            Salary = x;
        }
        public double getSalary()
        {
            return Salary;
        }


    }

    class Exchange_currency
    {
        double currency = 0;
        string current_currency;
        string other_currency;
        public void set_currency(double x)
        {
            currency = x;
        }
        public double get_currency()
        {
            return currency;
        }

        public void set_current_currency(string x)
        {

            current_currency = x;

        }
        public string get_current_currency()
        {
            return current_currency;
        }
        public void set_other_currency(string x)
        {
            other_currency = x;
        }
        public string get_other_currency()
        {
            return other_currency;
        }
        public double Ex_from_USD_to_EG()
        {
            return currency *= 7;


        }
        public double Ex_from_EURO_to_EG()
        {
            return currency *= 9.75;


        }
        public double Ex_from_EG_to_USD()
        {

            return currency /= 7;
        }
        public double Ex_from_EG_to_EURO()
        {

            return currency /= 9.75;
        }


    }
    }
   


